<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');



/**
* Set the location of where our plugins are located
* 
* @param mixed $directory
*/
function set_plugin_dir($directory)
{
    Plugins::instance()->set_plugin_dir($directory);
}

/**
* Activate a specific plugin
* 
* @param mixed $name
*/
function activate($name)
{
    return Plugins::instance()->activate_plugin($name);
}

/**
* Deactivate a specific plugin
* 
* @param mixed $name
*/
function deactivate($name)
{
    return Plugins::instance()->deactivate_plugin($name);
}

/**
* Print Plugins
* Returns the list of plugins
* 
*/
function print_plugins()
{
    return Plugins::instance()->print_plugins();
}

/**
* Return the number of plugins found
* 
*/
function count_found_plugins()
{
    return count(Plugins::$plugins_pool);
}

/**
* Return number of plugins activated
* 
*/
function count_activated_plugins()
{
    return count(Plugins::$plugins_active);
}

/**
* Debug function will return all plugins registered and hooks
* 
*/
function debug_class()
{
    Plugins::debug_class();
}

/**
* Return all errors
*
*/
function plugin_errors()
{
    if (is_array(Plugins::$errors))
    {
        foreach (Plugins::$errors AS $k => $error)
        {
            echo $error."\n\r";   
        }
    }
    else
    {
        return true;
    }
}

/**
* Return all messages
*
*/
function plugin_messages()
{
    if (is_array(Plugins::$messages))
    {
        foreach (Plugins::$messages AS $k => $message)
        {
            echo $message."\n\r";   
        }
    }
    else
    {
        return true;
    }
}
